<template>
	<view class="passenger-flow">
		<view class="con-1">
			<view class="bg">
				<view class="address">
					<view class="flex-space-between">
						<view class="flex-align">
							<van-image v-if="itemChooselist.venue_thumb != ''" width="74rpx" height="74rpx" radius="2"
								style="margin-right: 10rpx;" :src="itemChooselist.venue_thumb" />
							<van-image v-else width="74rpx" height="74rpx" radius="10rpx" fit="cover" style="margin-right: 10rpx;" src="https://img.yzcdn.cn/vant/cat.jpeg" />
							<view>
								<view class="address-name">{{itemChooselist.venue_name}}</view>
								<view class="address-desc">地址:{{itemChooselist.address}}</view>
							</view>
						</view>
						<view class="exchange flex-center flex-column " @click="show_no">
							<van-icon name="exchange" size="16" />
							切换
						</view>
					</view>
				</view>
			</view>
		</view>

		<scroll-view scroll-y style="height: 90vh;margin-top: 100rpx;">
			<view class="page flex-col">
				<view class="box_1 flex-col">
					<view class="block_5 flex-col">
						<view class="list_2 flex-row">
							<view class="image-text_4 flex-col justify-between" v-for="(item, index) in loopData1"
								:key="index">
								<image class="icon_4" referrerpolicy="no-referrer" :src="item.lanhuimage0" />
								<text class="text-group_4">{{item.lanhutext0}}</text>
							</view>
						</view>
						<view class="box_4 flex-row justify-between">
							<view class="text-wrapper_2">
								<text class="text_7">120</text>
								<text class="text_8">人</text>
							</view>
							<view class="text-wrapper_3">
								<text class="text_9">120</text>
								<text class="text_10">人</text>
							</view>
							<view class="text-wrapper_4">
								<text class="text_11">120</text>
								<text class="text_12">人</text>
							</view>
						</view>
					</view>
					<view class="block_4 flex-col">
						<view class="group_5 flex-row justify-between">
							<view class="text-wrapper_1">
								<text class="text_4">当前在场</text>
								<text class="text_5">58</text>
								<text class="text_6">名会员</text>
							</view>
							<view class="flex-row" @click="onClick">
								<view class="text_s">
									更多来访
								</view>
								<image class="icon_3" referrerpolicy="no-referrer"
									src="https://jiangsudiantuo2022.oss-cn-hangzhou.aliyuncs.com/img/63a3f270637fe78f52412fed67d43bab2f829a23.png" />
							</view>
						</view>
						<view class="list_1 flex-row">
							<view class="image-text_3 flex-col justify-between" v-for="(item, index) in loopData0"
								:key="index">
								<image class="single-avatar_1" referrerpolicy="no-referrer" :src="item.lanhuimage0" />
								<text class="text-group_3">{{item.lanhutext0}}</text>
							</view>
						</view>
					</view>

					<view class="block_6 flex-col">
						<view class="flex-row justify-between justify-center items-center"
							style="padding:40rpx 80rpx 40rpx; ">
							<view class="flex-col justify-center items-center" @click="birthdays">
								<view class="text_bri">25</view>
								<view class="text_xin">近期生日</view>
							</view>
							<view class="flex-col " @click="additions">
								<view class="text_bri">25</view>
								<view class="text_xin">近期新增</view>
							</view>
							<view class="flex-col " @click="card_application">
								<view class="text_bri">25</view>
								<view class="text_xin">近期办卡</view>
							</view>
						</view>
						<view class="group_a flex-col"></view>
						<view class="flex-row justify-between justify-center items-center"
							style="padding:40rpx 80rpx 40rpx;">
							<view class="flex-col justify-center items-center" @click="remaining">
								<view class="text_bri">25</view>
								<view class="text_xin">余次不足</view>
							</view>
							<view class="flex-col " @click="to_expire">
								<view class="text_bri">25</view>
								<view class="text_xin">即将到期</view>
							</view>
							<view class="flex-col " @click="balance">
								<view class="text_bri">25</view>
								<view class="text_xin">余额不足</view>
							</view>
						</view>
						<view class="group_a flex-col"></view>
						<view class="flex-row justify-between justify-center items-center"
							style="padding:40rpx 80rpx 40rpx;">
							<view class="flex-col justify-center items-center" @click="active_users">
								<view class="text_bri">25</view>
								<view class="text_xin">活跃用户</view>
							</view>
							<view class="flex-col " @click="not_recently">
								<view class="text_bri">25</view>
								<view class="text_xin">近期未登录</view>
							</view>
							<view class="flex-col " @click="dormant_user">
								<view class="text_bri">25</view>
								<view class="text_xin">休眠用户</view>
							</view>
						</view>
						<view class="group_a flex-col"></view>
						<view class="flex-row justify-between justify-center items-center"
							style="padding:40rpx 80rpx 40rpx;">
							<view class="flex-col justify-center items-center" @click="expert_list">
								<view class="text_brp">
									<image class="single-avatar_2" referrerpolicy="no-referrer"
										src="https://jiangsudiantuo2022.oss-cn-hangzhou.aliyuncs.com/img/7a79311565a8f4e2826de065304d4f22b85a4c91.png" />
									<text class="text_29">启智珑</text>
								</view>
								<view class="text_xin">今日最多到场</view>
							</view>
							<view class="flex-col ">
								<view class="text_brp">
									<image class="single-avatar_2" referrerpolicy="no-referrer"
										src="https://jiangsudiantuo2022.oss-cn-hangzhou.aliyuncs.com/img/7a79311565a8f4e2826de065304d4f22b85a4c91.png" />
									<text class="text_29">启智珑</text>
								</view>
								<view class="text_xin">今日消费最多</view>
							</view>
							<view class="flex-col ">
								<view class="text_brp">
									<image class="single-avatar_2" referrerpolicy="no-referrer"
										src="https://jiangsudiantuo2022.oss-cn-hangzhou.aliyuncs.com/img/7a79311565a8f4e2826de065304d4f22b85a4c91.png" />
									<text class="text_29">启智珑</text>
								</view>
								<view class="text_xin">今日在场最久</view>
							</view>
						</view>
						
					</view>
				</view>
			</view>
		</scroll-view>
		<!-- <v-gap /> -->

		<van-popup closeable :show="show" round position="bottom" get-container="body" @close="showclose"
			:z-index='9999'>
			<view class="good-box">
				<view class="title">
					切换场馆
				</view>
				<view class="good-list">
					<view class="good-item" v-for="(item,index) in venuelist" :key="index" @click="onChangelist(item)">
						<view class="flex-align">
							<van-image width="124rpx" height="124rpx" radius="10rpx" fit="cover"
								v-if="item.venue_thumb != ''" :src="item.venue_thumb" />
							<van-image v-else width="124rpx" height="124rpx" radius="10rpx" fit="cover"
								src="https://img.yzcdn.cn/vant/cat.jpeg" />
							<view class="info">
								<view class="name">{{item.venue_name}}</view>
								<view class="flex-align" v-if="item.project_list != ''">
									<view class="tag" v-if="item.project_list[0].name != ''">
										{{item.project_list[0].name}}
									</view>
									<view class="tag" v-if="item.project_list[1].name != '' && item.project_list[1]">
										{{item.project_list[1].name}}
									</view>
									<view class="tag" v-if="item.project_list[2].name != ''&& item.project_list[2]">
										{{item.project_list[2].name}}
									</view>
								</view>
								<view class="address">{{item.address}}</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</van-popup>
	</view>
</template>

<script>
	const personal = require("@/api/personal/index.js");
	export default {
		data() {
			return {

				lineChartData: {},
				show: false,
				venuelist: [], //场馆列表
				itemChoose: {}, // 场馆数据
				itemChooselist: {}, // 场馆数据
				loopData0: [{
						lanhuimage0: 'https://jiangsudiantuo2022.oss-cn-hangzhou.aliyuncs.com/45/9e19f395e62069d85a20ffe52d0192.jpg?attname=%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20230425084656.jpg',
						lanhutext0: '祁智龙',
					},
					{
						lanhuimage0: 'https://jiangsudiantuo2022.oss-cn-hangzhou.aliyuncs.com/45/9e19f395e62069d85a20ffe52d0192.jpg?attname=%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20230425084656.jpg',
						lanhutext0: '气质隆',
					},
					{
						lanhuimage0: 'https://jiangsudiantuo2022.oss-cn-hangzhou.aliyuncs.com/45/9e19f395e62069d85a20ffe52d0192.jpg?attname=%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20230425084656.jpg',
						lanhutext0: '旗帜笼',
					},
				],
				loopData1: [{
						// lanhuimage0: 'https://jiangsudiantuo2022.oss-cn-hangzhou.aliyuncs.com/img/3c3032a9db4f6a1ff80b700ef5fdb7f4c09e67cd.png',
						lanhutext0: '平均购买力',
					},
					{
						// lanhuimage0: 'https://jiangsudiantuo2022.oss-cn-hangzhou.aliyuncs.com/img/57b975a088fa467d53b29fd52f3ce4ef95e297df.png',
						lanhutext0: '平均到访率',
					},
					{
						// lanhuimage0: 'https://jiangsudiantuo2022.oss-cn-hangzhou.aliyuncs.com/img/9f2192affd7be8deaa4c3ed9963b6c67d86d113d.png',
						lanhutext0: '平均消费时长',
					},
				],
				constants: {},
			}
		},
		onLoad() {
			// 场馆数组
			if (uni.getStorageSync("entry_name") == '') {
				uni.showToast({
					title: '请登录！',
					icon: 'exception',
					duration: 850
				});
				setTimeout(() => {
					uni.navigateTo({
						url: '/pages/my-center/my-center'
					})
				}, 1000);
			}
			var data = uni.getStorageSync("wqzdy");
			var items = JSON.parse(data)
			this.venuelist = items
			this.itemChooselist = this.venuelist[0]
		},
		methods: {
			// 今日最多到场
			expert_list(){
				uni.navigateTo({
					url: './expert_list'
				})
			},
			// 余次不足
			remaining(){
				uni.navigateTo({
					url: './recent/remaining'
				})
			},
			// 即将到期
			to_expire(){
				uni.navigateTo({
					url: './recent/to_expire'
				})
			},
			// 余额不足
			balance(){
				uni.navigateTo({
					url: './recent/balance'
				})
			},
			// 活跃用户
			active_users(){
				uni.navigateTo({
					url: './recent/active_users'
				})
			},
			// 近期未登录
			not_recently(){
				uni.navigateTo({
					url: './recent/not_recently'
				})
			},
			// 休眠用户
			dormant_user(){
				uni.navigateTo({
					url: './recent/dormant_user'
				})
			},
			// 近期生日
			birthdays(){
				uni.navigateTo({
					url: './recent/birthdays'
				})
			},
			// 近期新增
			additions(){
				uni.navigateTo({
					url: './recent/additions'
				})
			},
			// 近期办卡
			card_application(){
				uni.navigateTo({
					url: './recent/additions'
				})
			},
			// 更多来访
			onClick() {
				uni.navigateTo({
					url: './detail'
				})
			},
			async analyse() {
				let params = {
					venue_id: this.itemChooselist.id,
					sourceTab: this.nac
				};
				let res = await personal.analyse(params);
				if (res.code == 1) {
					this.lineChartData = res.data.lineChartData
				}
			},
			// 选中场馆
			onChangelist(item) {
				this.itemChoose = item
				this.lineChartData = []
				this.itemChooselist = this.itemChoose
				this.show = false
			},
			// 点击切换
			show_no() {
				this.show = true
			},
			// 关闭选择场馆弹窗
			showclose() {
				this.show = false
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import '../../static/css/member/common.css';
	@import '../../static/css/member/index.rpx.scss';

	.passenger-flow {
		width: 100%;
		height: 100vh;
		display: flex;
		flex-direction: column;
		background-color: rgb(255, 255, 255);
		padding: 0rpx 0 50rpx 0;
		position: relative;

		.con-1 {
			width: 100%;
			position: relative;
			padding: 0 20rpx;

			.bg {
				width: 95%;
				height: 134rpx;
				background: #FFFFFF;
				box-shadow: 0rpx 13rpx 57rpx 0rpx rgba(8, 73, 162, 0.11);
				border-radius: 20rpx;
				position: fixed;
				z-index: 9;
				top: 20rpx;

				.address {
					color: #fff;
					// padding-top: 20rpx;
					padding-right: 30rpx;
					padding-left: 30rpx;
					height: 150rpx;

					&-name {
						font-size: 34rpx;
						font-weight: 700;
						line-height: 34rpx;
						font-family: PingFang SC;
						color: #333333;
					}

					&-desc {
						margin-top: 18rpx;
						font-size: 22rpx;
						line-height: 22rpx;
						font-family: PingFang SC;
						color: #333333;
					}

					.exchange {
						width: 100rpx;
						height: 100rpx;
						border-radius: 50%;
						background-color: rgba(0, 0, 0, 0.04);
						color: rgb(0, 0, 0);
						font-size: 24rpx;
					}
				}
			}
		}

		/deep/ .good-box {
			height: 60vh;
			padding: 0rpx 30rpx;
			display: flex;
			flex-direction: column;

			.title {
				color: #000;
				font-size: 30rpx;
				font-weight: 700;
				margin-top: 40rpx;
			}

			.van-radio__label {
				line-height: inherit;
			}

			.good-list {
				flex: 1;
				height: 0;
				overflow: auto;

				.good-item {
					margin-top: 30rpx;

					.info {
						margin-left: 25rpx;

						.address {
							color: #fff;
							padding-top: 20rpx;
							padding-right: 30rpx;
							height: 70rpx;

							&-name {
								font-size: 34rpx;
								font-weight: 700;
								line-height: 34rpx;
							}

							&-desc {
								margin-top: 18rpx;
								font-size: 22rpx;
								line-height: 22rpx;
							}

							.exchange {
								width: 100rpx;
								height: 100rpx;
								border-radius: 50%;
								background-color: rgba(0, 0, 0, 0.2);
								color: rgb(234, 248, 248);
								font-size: 24rpx;
							}
						}

						.name {
							color: rgb(51, 51, 51);
							font-size: 30rpx;
							font-weight: 500;
							margin-bottom: 10rpx;
						}


						.tag {
							color: rgb(4, 179, 90);
							font-size: 24rpx;
							font-weight: 500;
							padding: 0px 10rpx;
							margin-right: 20rpx;
							background-color: rgba(4, 179, 90, 0.2);
							border-radius: 4rpx;

							&:nth-of-type(2) {
								color: rgb(236, 70, 246);
								background-color: rgba(236, 70, 246, 0.2);
							}
						}

						.address {
							margin-top: 10rpx;
							color: rgb(136, 136, 136);
							font-size: 22rpx;
						}
					}

				}
			}

			.footer {
				padding: 20rpx 0;
				background-color: rgb(255, 255, 255);

				.btn {
					color: rgb(255, 255, 255);
					font-size: 30rpx;
					font-weight: 700;
					padding: 20rpx 0;
					text-align: center;
					background-image: linear-gradient(0deg, rgb(99, 93, 247) 0%, rgb(165, 173, 246) 100%);
					border-radius: 60rpx;
				}
			}
		}

		.con-3 {
			width: 100%;
			height: 80rpx;
			background-color: rgb(248, 248, 248);
			color: rgb(51, 51, 51);
			font-size: 28rpx;
			font-weight: 700;

			.con-3_left {
				float: left;
				line-height: 80rpx;
				margin-left: 29rpx;
			}

			.con-3_right {
				float: right;
				line-height: 80rpx;
				color: rgb(90, 101, 255);
				margin-right: 29rpx;
			}
		}


		.title {
			font-size: 28rpx;
			font-weight: 700;
		}

		.text_bri {
			text-align: center;
			color: rgba(255, 65, 5, 1);
			font-size: 36rpx;
			font-weight: 700;
		}
		.text_brp {
			text-align: center;
			color: rgba(51, 51, 51, 1);
			font-size: 24rpx;
			font-weight: 500;
			display: flex;
			align-items: center;
		}

		.text_xin {
			color: rgba(153, 153, 153, 1);
			font-size: 22rpx;
			margin-top: 10rpx;
		}

		.group_a {
			background-color: rgba(229, 229, 229, 1);
			width: 690rpx;
			height: 1rpx;
		}
		.single-avatar_2 {
		  width: 40rpx;
		  height: 40rpx;
		}

	}
</style>